<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>08-mouseenter和mouseover的区别</title>
  <style>
    .father {
      width: 300px;
      height: 300px;
      background-color: pink;
      margin: 100px auto;
    }

    .son {
      width: 200px;
      height: 200px;
      background-color: purple;
    }
  </style>
</head>

<body>
  <div class="father">
    <div class="son"></div>
  </div>
  <script>
    var father = document.querySelector('.father');
    var son = document.querySelector('.son');

    father.addEventListener('mouseenter', function () {
      console.log('鼠标经过父盒子');
    })

    father.addEventListener('mouseleave', function () {
      console.log('鼠标离开父盒子');
    })


  </script>
</body>

</html>